const URL = require('./server.config.js')
const request = require('./request')
const api = request.api
const app = getApp()
const upload = request.upload

module.exports = {
    api,

    //session_key过期校验
    loginCheck: function (callback) {
        let that = this;
        wx.login({
            success: function (res) {
                console.log(res)
                console.log('登陆成功')
                callback(false, res.code)
            },
            fail: function (res) {
                console.log('登陆失败')
                console.log(res)
            }
        })
    },

    //登录
    userWXLogin(data, callback, failback, pageobj) {
        api(URL.url_user_login, data, callback, failback, pageobj, true,false, true)
    },

    //用户注册
    userRegistered(data, callback, failback, pageobj) {
        api(URL.url_userinfo_update, data, callback, failback, pageobj, true, true, true)
    },

    //获取配置项
    getAppConfig(data, callback, failback, pageobj) {
        api(URL.url_banner_status, data, callback, failback, pageobj, true, true, true)
    },
    
}